package com.wjj.sixinone.controller.admin;


import com.wjj.sixinone.common.enums.ApiTypeConst;
import com.wjj.sixinone.common.pojo.vo.InstrumentFrom;
import com.wjj.sixinone.common.pojo.vo.InstrumentVO;
import com.wjj.sixinone.common.util.Result;
import com.wjj.sixinone.handler.ExcelExportHandle;
import com.wjj.sixinone.service.InstrumentService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小王不秃头
 * @since 2024-07-22
 */
@RestController
@RequestMapping(ApiTypeConst.API_ADMIN+"/instrument")
public class InstrumentController {
    @Autowired
    private InstrumentService instrumentService;


    @GetMapping("/selectInstrumentByLimit")
    public Result selectInstrumentByLimit(InstrumentVO instrumentVO){

        return instrumentService.selectInstrumentByLimit(instrumentVO);
    }
    @GetMapping("/uploadExcel")
    public void uploadExcel(HttpServletResponse httpServletResponse){
         instrumentService.uploadExcel(httpServletResponse);
    }

    @PostMapping("/updateById")
    public Result updateById(@RequestBody InstrumentFrom instrument){
        return instrumentService.updateInstrumentById(instrument);
    }
    @PostMapping("/addInstrument")
    public Result addInstrument(@RequestBody InstrumentFrom instrument){
        return instrumentService.addInstrument(instrument);
    }
    @PostMapping("/deleteById")
    public Result deleteById(@RequestBody Map<String,String> map){
        return instrumentService.deleteById(map);
    }
}

